<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="_csrf" th:content="${_csrf.token}"/>
    <meta name="_csrf_header" th:content="${_csrf.headerName}"/>
    <title>闲言文章审核</title>
    <link th:include="fragment/import :: import">
</head>
<body id="articleData">
<div class="layui-tab layui-tab-card">
    <ul class="layui-tab-title">
        <li class="layui-this" id="unPassedArticle">
            未审核文章
        </li>
        <li id="passedArticle">
            已审核文章
        </li>
    </ul>
    <div class="layui-tab-content" style="padding-top: 0px">
        <div class="layui-tab-item layui-show" data-id="1">
            <!--已审核的-->
            <table class="layui-hide" id="test" lay-filter="test"></table>
        </div>
        <div class="layui-tab-item" data-id="2">
            <!--未审核的-->
            <table class="layui-hide" id="passExamine" lay-filter="test"></table>
        </div>
    </div>
</div>

</body>
<script type="text/html" id="barDemo">
    <a class="layui-btn layui-btn-xs" lay-event="detail">查看</a>
    <a class="layui-btn layui-btn-xs" lay-event="pass">通过</a>
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="noPass">不通过</a>
</script>
<script type="text/html" id="passBarDemo">
    <a class="layui-btn layui-btn-xs" lay-event="detail">查看</a>
</script>
<script type="text/html" id="titleTpl">
    {{#  if(d.isPassed.id == 'YES'){ }}
        是
    {{#  } else { }}
        <span style="color: red">
            否
        </span>
    {{#  } }}
</script>
<script>
    layui.config({
        base: '../../static/js/admin/examine/'
    }).extend({ //设定模块别名
        pass: 'pass' //如果 mymod.js 是在根目录，也可以不用设定别名
    }).use('pass');
</script>
<script type="text/javascript" th:inline="none">
    layui.use('table', function(){
        var table = layui.table;
        /*未审核列表*/
        table.render({
            elem: '#test'
            ,url:'/admin/examine/articleExamineList'
            ,cellMinWidth: 80 //全局定义常规单元格的最小宽度，layui 2.2.1 新增
            ,page: true
            , request: {
                pageName: 'pageNumber' //页码的参数名称，默认：page
                , limitName: 'pageSize' //每页数据量的参数名，默认：limit
            }
            ,cols: [[
                {field:'title', title: '标题'}
                ,{field:'witter', title: '作者'}
                ,{field:'createTime',  title: '创建时间', sort: true}
                ,{field:'content', title: '内容'}
                ,{field:'isPassed', title: '是否通过',templet:'#titleTpl'}//minWidth：局部定义当前单元格的最小宽度，layui 2.2.1 新增
                ,{fixed: 'right',title:'操作', align:'center', toolbar: '#barDemo'}
            ]]

        });

        /*审核过的列表*/
        table.render({
            elem: '#passExamine'
            ,url:'/admin/examine/articleExamineList/Yes'
            ,cellMinWidth: 80 //全局定义常规单元格的最小宽度，layui 2.2.1 新增
            ,page: true
            , request: {
                pageName: 'pageNumber' //页码的参数名称，默认：page
                , limitName: 'pageSize' //每页数据量的参数名，默认：limit
            }
            ,cols: [[
                {field:'title', title: '标题'}
                ,{field:'witter', title: '作者'}
                ,{field:'createTime',  title: '创建时间', sort: true}
                ,{field:'content', title: '内容'}
                ,{field:'isPassed', title: '是否通过',templet:'#titleTpl'}//minWidth：局部定义当前单元格的最小宽度，layui 2.2.1 新增
                ,{fixed: 'right', align:'center', toolbar: '#passBarDemo'}
            ]]

        });

    });
</script>
</html>